Don't assume statusbar->label is the statusbar's frame's child when
authorChristian Persch <chpe@cvs.gnome.org>
Mon, 25 Dec 2006 12:12:10 +0000 (12:12 +0000)
committerChristian Persch <chpe@src.gnome.org>
Mon, 25 Dec 2006 12:12:10 +0000 (12:12 +0000)
2006-12-25  Christian Persch  <chpe@cvs.gnome.org>

* gtk/gtkstatusbar.c: (gtk_statusbar_size_allocate):
Don't assume statusbar->label is the statusbar's frame's child when
shrinking the size allocation when the grip is shown. Bug #372452.

ChangeLog
gtk/gtkstatusbar.c

index d6dc59119bf38ee4d31bae3b2bca1fd9baf176c3..08009cc5cd06013adcd8c76a822191d669285572 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2006-12-25  Christian Persch  <chpe@cvs.gnome.org>
+
+       * gtk/gtkstatusbar.c: (gtk_statusbar_size_allocate):
+       Don't assume statusbar->label is the statusbar's frame's child when
+       shrinking the size allocation when the grip is shown. Bug #372452.
+
 2006-12-25  Christian Persch  <chpe@cvs.gnome.org>
 
        * gtk/gtkpagesetupunixdialog.c: (printer_status_cb),
index 11a2e96c70b94ab94bd246fc09b236d860620477..252e1650962088ac5b644361a06ba4f1541bd6aa 100644 (file)
@@ -802,15 +802,23 @@ gtk_statusbar_size_allocate  (GtkWidget     *widget,
        }
       else
        {
-         if (statusbar->label->allocation.width + rect.width > statusbar->frame->allocation.width)
+         GtkWidget *child;
+
+         /* Use the frame's child instead of statusbar->label directly, in case
+          * the label has been replaced by a container as the frame's child
+          * (and the label reparented into that container).
+          */
+         child = gtk_bin_get_child (GTK_BIN (statusbar->frame));
+
+         if (child->allocation.width + rect.width > statusbar->frame->allocation.width)
            {
              /* shrink the label to make room for the grip */
-             *allocation = statusbar->label->allocation;
+             *allocation = child->allocation;
              allocation->width = MAX (1, allocation->width - rect.width);
              if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) 
-               allocation->x += statusbar->label->allocation.width - allocation->width;
+               allocation->x += child->allocation.width - allocation->width;
 
-             gtk_widget_size_allocate (statusbar->label, allocation);
+             gtk_widget_size_allocate (child, allocation);
            }
        }
     }